<template>
	<view class="content">
		<web-view :src="webViewUrl"></web-view>
	</view>
</template>

<script>
	export default {
		data() {
			return {
				userInfo: {
					sdkAppId: null,
					userId: '',
					userSig: '',
					userName: '',
					avatarUrl: ''
				},
				webViewUrl: '',
			}
		},
		onLoad(e) {
			console.log(e.groupID, "群ID")
			let info = require('@/siteinfo');
			var user_info = uni.getStorageSync('user_info') || {};
			this.userInfo.sdkAppId = info.SDKAPPID;
			this.userInfo.userId = user_info.id;
			this.userInfo.avatarUrl = user_info.avatarUrl;
			this.userInfo.userName = user_info.name;
			this.userInfo.userSig = uni.getStorageSync('userSig');
			let userInfojson = JSON.stringify((this.userInfo))

			// this.webViewUrl =
			// 	`http://192.168.0.4:9146/#/?roomId=${e.groupID}&userInfo=${userInfojson}`
			this.webViewUrl =
				`https://meeting.tanao.space/#/?roomId=${e.groupID}&userInfo=${userInfojson}`

			this.watchPermission();
			this.requestPermission();
		},
		methods: {
			watchPermission() {
				if (uni.getSystemInfoSync().platform === 'android') {
					this.permissionListener = uni.createRequestPermissionListener();
					this.permissionListener.onRequest((e) => {
						console.error('lixin 333 permissionListener', e);
					})
				}
			},
			requestPermission() {
				if (uni.getSystemInfoSync().platform == 'ios') {
					return
				} else {
					plus.android.requestPermissions(["android.permission.MODIFY_AUDIO_SETTINGS",
						"android.permission.RECORD_AUDIO", "android.permission.CAMERA"
					], (e) => {
						console.error('lixin 111', e);
					}, (e) => {
						console.error('lixin 222', e);
					})
				}

			}
		}
	}
</script>

<style>
	.content {
		width: 100%;
		height: 100%;
	}
</style>